
package com.googlecode.mvndroid.tools;

import com.googlecode.mvndroid.AndroidMojo;
import java.io.IOException;
import java.net.Socket;

/**
 * Android's emulator
 *
 * @author <a href="mailto:1.024e3@gmail.com">Bartosz Duzy</a>
 */
public class EmulatorTool extends AndroidTool{

    public EmulatorTool(AndroidMojo sharedContext){
        super(sharedContext);
    }
    public boolean isStarted() {
        try {
            Socket socket = new Socket(context.getEmulatorHost(),context.getEmulatorPort());
            socket.close();
            return true;
        } catch (IOException e) {
            return false;
        }
    }

    @Override
    protected String getErrorMessage() {
        return "Emulator tool execution failed";
    }

    @Override
    protected String getName() {
        return "emulator";
    }

}
